<?php

$sql = <<<EOF
CREATE TABLE IF NOT EXISTS `ims_weidun_card_setting` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '应用编号',
  `codename` varchar(32) NOT NULL DEFAULT '' COMMENT '字段名称',
  `value` text NOT NULL COMMENT '值',
  PRIMARY KEY (`id`),
  KEY `uniacid_codename` (`uniacid`,`codename`)
) ENGINE = MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片配置';
CREATE TABLE  IF NOT EXISTS `ims_weidun_card_quickmenu` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '应用编号',
  `title` varchar(15) NOT NULL DEFAULT '' COMMENT '标题',
  `name` varchar(15) NOT NULL DEFAULT '' COMMENT '名称',
  `link` varchar(320) NOT NULL DEFAULT '' COMMENT '链接',
  `sort` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '显示顺序',
  `ido` varchar(32) NOT NULL DEFAULT '' COMMENT '路径',
  `icon` varchar(100) NOT NULL DEFAULT '' COMMENT '图标',
  `status` tinyint(2) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态',
  `create_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_status` (`uniacid`,`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片底部菜单';
CREATE TABLE IF NOT EXISTS  `ims_weidun_card_navigate` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '应用编号',
  `name` varchar(15) NOT NULL DEFAULT '' COMMENT '名称',
  `image` varchar(200) NOT NULL DEFAULT '' COMMENT '图标',
  `link` varchar(320) NOT NULL DEFAULT '' COMMENT '链接',
  `sort` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '显示顺序',
  `create_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片导航菜单';
CREATE TABLE IF NOT EXISTS  `ims_weidun_card_slider` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT,
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '应用编号',
  `title` varchar(255) NOT NULL DEFAULT '' COMMENT '轮播图标题',
  `image` varchar(255) NOT NULL DEFAULT '' COMMENT '轮播图',
  `link` varchar(255) NOT NULL DEFAULT '' COMMENT '轮播图链接',
  `status` tinyint(2) UNSIGNED NOT NULL DEFAULT '1' COMMENT '状态',
  `sort` int(11) UNSIGNED NOT NULL DEFAULT '0' COMMENT '显示顺序',
  `type` tinyint(1) UNSIGNED NOT NULL DEFAULT '1' COMMENT '轮播图位置,默认首页',
  `create_time` int(10) UNSIGNED NOT NULL DEFAULT '0' COMMENT '创建时间',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片轮播图';
CREATE TABLE IF NOT EXISTS `ims_weidun_card_category` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '应用编号',
  `name` varchar(30) NOT NULL DEFAULT '' COMMENT '分类名称',
  `image` varchar(250) NOT NULL DEFAULT '' COMMENT '图标',
  `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '顺序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否开启,0:关闭,1:打开',
  `create_time` int(10) NOT NULL COMMENT '创建时间',
  `update_time` int(10) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_status` (`uniacid`,`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片分类';
CREATE TABLE IF NOT EXISTS `ims_weidun_card_tips` (
  `id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '应用编号',
  `category_id` int(11) unsigned NOT NULL DEFAULT 0 COMMENT '分类编号',
  `title` varchar(50) NOT NULL DEFAULT '' COMMENT '标题',
  `content` varchar(500) NOT NULL DEFAULT '' COMMENT '知识内容',
  `praise_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '点赞数',
  `receive_count` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '收藏数',
  `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否显示,0:隐藏,1:显示',
  `create_time` int(10) NOT NULL COMMENT '创建时间',
  `update_time` int(10) NOT NULL COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_status` (`uniacid`,`status`),
  KEY `uniacid_category_id_status` (`uniacid`,`category_id`,`status`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='知识卡片内容';
CREATE TABLE IF NOT EXISTS `ims_weidun_card_praise` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用编号',
  `openid` varchar(60) NOT NULL DEFAULT '' COMMENT '点赞用户openid',
  `tips_id` int(11) NOT NULL COMMENT '内容id',
  `create_time` int(10) NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_openid` (`uniacid`,`openid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT '知识卡片点赞';
CREATE TABLE IF NOT EXISTS `ims_weidun_card_receive` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用编号',
  `openid` varchar(60) NOT NULL DEFAULT '' COMMENT '收藏用户openid',
  `tips_id` int(11) NOT NULL COMMENT '内容id',
  `create_time` int(10) NOT NULL COMMENT '创建时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_openid` (`uniacid`,`openid`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT '知识卡片收藏';
CREATE TABLE IF NOT EXISTS `ims_weidun_card_article` (
  `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '编号',
  `uniacid` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '应用编号',
  `category_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '分类编号',
  `writer` varchar(30) NOT NULL DEFAULT '' COMMENT '作者',
  `title` varchar(60) NOT NULL DEFAULT '' COMMENT '标题',
  `thumb` varchar(250) NOT NULL DEFAULT '' COMMENT '缩略图',
  `content` text NOT NULL DEFAULT '' COMMENT '内容',
  `link` varchar(500) NOT NULL DEFAULT '' COMMENT '外链',
  `read_count` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '阅读数',
  `sort` int(10) unsigned NOT NULL DEFAULT '0' COMMENT '排序',
  `status` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT '是否显示,0:隐藏,1:显示',
  `create_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '创建时间',
  `update_time` int(10) UNSIGNED NOT NULL DEFAULT 0 COMMENT '更新时间',
  PRIMARY KEY (`id`),
  KEY `uniacid_status` (`uniacid`,`status`),
  KEY `uniacid_category_id_status` (`uniacid`,`category_id`,`status`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT '知识卡片文章';
EOF;

pdo_query($sql);
